package com.golf.server.selection;

import java.util.ArrayList;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

/**
 * 
 * 
 * @author gfloodgate
 */
public class Lobby 
{
	
	
	/** */
	private final Set<Room> rooms = new HashSet<Room>();
	
	/** */
	private final Set<User> guests = new HashSet<User>();
	
	
	
	
	/**
	 * 
	 * 
	 * @return
	 */
	public List<Room> listRooms()
	{
		synchronized (rooms)
		{
			final List<Room> copy = new ArrayList<Room>(rooms);
			return Collections.unmodifiableList(copy);
		}
	}
	
	
	/**
	 * 
	 * 
	 * @param name
	 * @param creator
	 * @return 
	 */
	public Room createRoom(final String name, final User creator)
	{
		synchronized (rooms)
		{
			final Room room = new Room(name, creator); 
			rooms.add(room);
			
			return room;
		}
	}


	/**
	 * 
	 * 
	 * @param roomName
	 */
	public void dropRoom(final String roomName)
	{
		synchronized (rooms)
		{
		}	
	}
	
	
	/**
	 * 
	 * 
	 * @param user
	 */
	public void addGuest(final User user)
	{
		synchronized (guests)
		{
			guests.add(user);
		}	
	}
	
	
	/**
	 * 
	 * 
	 * @param user
	 */
	public void removeGuest(final User user)
	{
		synchronized (guests)
		{
		}	
	}
	
}
